package me.linkcn.ydtxl.server;

import me.linkcn.ydtxl.server.objects.Account;
import me.linkcn.ydtxl.server.objects.ObjectsFacade;
import org.restlet.security.MapVerifier;

/**
 * Created by IntelliJ IDEA.
 * User: cmcc
 * Date: 11-8-26
 * Time: 下午11:06
 */
public class TxlGuard extends MapVerifier {
    protected ObjectsFacade dataFacade;
    public final static String CURRENT_USER = "CURRENT_USER";

    public TxlGuard(ObjectsFacade dataFacade) {
        super();
        this.dataFacade = dataFacade;
    }

    @Override
    public boolean verify(String identifier, char[] secret) {
        final Account account = this.dataFacade.getAccountByLoginPwd(identifier, secret);
        if (account != null) {
            return true;
        }

        return false;
    }
}
